//
//  BLBaseRequest.h
//  BasketBallLeagues
//
//  Created by kenshin on 4/24/17.
//  Copyright © 2017 kenshin. All rights reserved.
//

#import "KSNetworking.h"


typedef NS_ENUM(NSInteger, BLAPIErrorCode) {
    BLAPIErrorCodeNotLogin = 4000,   ///< 未登录
    BLAPIErrorCodeSuccess = 0,   ///< 没有错误
};



/// JSON数据模型基类，所有属性都为Optional
@interface BLModel : JSONModel

- (NSDictionary *)filteredDictionary;

@end

@interface TKBaseResult : BLModel

@property (nonatomic, strong) NSDictionary *info;
@property (nonatomic, strong) NSDictionary *extra;
@property (nonatomic, strong) NSMutableArray *list;

@end

///// 网络请求响应主体类
//@interface BLBaseResponseBody : BLModel
//
//@property (nonatomic, copy) NSString *code; ///< 业务状态码，10000正常，其它业务异常
//@property (nonatomic, copy) NSString *msg;  ///< 业务信息
//
//@end

/// 网络请求响应基类
@interface BLBaseResponse : BLModel

@property (nonatomic) NSInteger errcode; ///< 业务状态错误码，0正常，其它业务异常
@property (nonatomic, copy) NSString *errmsg; ///< 业务状态错误信息

@property (nonatomic, strong) NSDictionary *info;
@property (nonatomic, strong) NSDictionary *extra;
@property (nonatomic, strong) NSMutableArray *list;

//
//@property (nonatomic, strong) NSDictionary *extra; //result->extra
//@property (nonatomic, strong) TKBaseResult *result;

@property (nonatomic, strong) id<Ignore> jsonDict;


/**
 是否成功（业务逻辑上的成功）

 @return 是否成功
 */
- (BOOL)isSuccess;

+ (NSDictionary *)baseKeyToMapper;

@end


/// 网络请求基类
@interface BLBaseRequest : KSBaseRequest

@property (nonatomic, copy) NSString *sign; //加密后的密文  Sign=md5(user_id + curtime + “yichangyanchu”)
@property (nonatomic, copy) NSString *user_id; //用户id，未登录为0
@property (nonatomic) NSInteger device;// 手机平台：1-IOS 2-android
//@property (nonatomic, copy) NSString *token; ///< 用户token，登录后赋值
@property (nonatomic, copy) NSString *curtime; //请求时间戳
@property (nonatomic, copy) NSString *os_version; //平台版本
@property (nonatomic, copy) NSString *version; //APP版本

@end
